<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>H+ 后台主题UI框架 - 基本表单</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="{:ADDON_PUBLIC_PATH}/admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="{:ADDON_PUBLIC_PATH}/admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="{:ADDON_PUBLIC_PATH}/admin/css/animate.min.css" rel="stylesheet">
     <link href="{:ADDON_PUBLIC_PATH}/admin/css/layer.css" rel="stylesheet">
    <link href="{:ADDON_PUBLIC_PATH}/admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
         <form name='fileForm' class="form-horizontal" >
            <div class="form-group">
                <label class="col-sm-3 control-label">分类名称：</label>
                <div class="col-sm-8">
                  <input type="text" value="{$name}" placeholder="请输入分类名" name='cl_name' class="form-control">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">上传图片：</label>
                <div class="col-sm-8">
                    <img id="xmTanImg" src="{$img}" style="width: 200px;" />
                    <input type="file" id="xdaTanFileImg" onchange="xmTanUploadImg(this)" accept="image/*" name="photo"/>
                </div>
            </div>
            <input type="hidden" name="parentid" value="{$parentid}">
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-8">
                    <input type="submit" class="btn btn-sm btn-white"/>
                </div>
            </div>
        </form>
    </div>
    <script src="{:ADDON_PUBLIC_PATH}/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="{:ADDON_PUBLIC_PATH}/admin/js/layer.js"></script>
    <script src="https://cdn.bootcss.com/jquery.form/4.2.2/jquery.form.js"></script>
    <script src="{:ADDON_PUBLIC_PATH}/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="{:ADDON_PUBLIC_PATH}/admin/js/content.min.js?v=1.0.0"></script>
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
    <script type="text/javascript"> 
        //判断浏览器是否支持FileReader接口
        if (typeof FileReader == 'undefined') {
           layer.msg('当前浏览器不支持FileReader接口');
            //使选择控件不可操作
            document.getElementById("xdaTanFileImg").setAttribute("disabled", "disabled");
        }

        //选择图片，马上预览
        function xmTanUploadImg(obj) {
            var file = obj.files[0];
            
            // console.log(obj);console.log(file);
            // console.log("file.size = " + file.size);  //file.size 单位为byte

            var reader = new FileReader();

            //读取文件过程方法
            reader.onloadstart = function (e) {
                console.log("开始读取....");
            }
            reader.onprogress = function (e) {
                console.log("正在读取中....");
            }
            reader.onabort = function (e) {
                console.log("中断读取....");
            }
            reader.onerror = function (e) {
                console.log("读取异常....");
            }
            reader.onload = function (e) {
                console.log("成功读取....");

                var img = document.getElementById("xmTanImg");
                // img.style.display="inline";
                img.src = e.target.result;
                //或者 img.src = this.result;  //e.target == this
            }
            reader.readAsDataURL(file)
        }

        $("form").submit(function(e){
            e.preventDefault();
            var form = $("form[name=fileForm]"); 
            var options = {  
                url:'__CONTROLLER__/createCls',
                type:'post',
                success:function(data){  
                   if (data.status == 200) {
                    layer.msg(data.msg,{time:1000},function(){
                        parent.location.reload();
                    });
                   }else {
                    layer.msg(data.msg);
                   }
                },
                error:function(){
                    layer.msg("服务器错误,请联系管理员");
                }
             };  
            form.ajaxSubmit(options);
        });
    </script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
</html>
